export const addSelection = (editor) => {
    const {
        Components
    } = editor;
    Components.addType('addSelection', {
        model: {
            defaults: {
                name: 'addSelection',
                droppable: true,
                tagName: 'input',
                attributes: {
                    type: "date",
                    'data-gjs-type':"addSelection",
                },
                traits:[
                    {  
                      type: 'text',  
                      label: '标题',  
                      name: 'title',  
                      default: '' 
                    },  
                    {  
                      type: 'text',  
                      label: 'id',  
                      name: 'id'
                    }, 
                    {
                        type: 'text',
                        label: 'placeholder',
                        name: 'placeholder'
                    }, 
                    {
                        type: 'select',
                        label: 'type',
                        name: 'type',
                        options: [ 'text', 'password', 'email', 'tel', 'date', 'button',
                            "checkbox","color",'datetime-local',"file","hidden","image",
                            "month","week","number","radio","range","reset","url","search","submit","time"
                        ],
                    }, 
                    {
                        type: 'checkbox',
                        label: 'required',
                        name: 'required'
                    }
                  ],
                script() {
                    var thx = document.getElementById(this.attributes.id.value);
                },
                styles: `
                    
                `
            },
            init() {

            },
        }
    });

    // 注册组件
    editor.BlockManager.add('add-selection', {
        label: '输入框',
        category: 'Basic',
        media: `<svg t="1720939237347" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3202" width="30" height="30"><path d="M118.784 727.04h778.24V296.96h-778.24v430.08zM77.824 256h860.16v512H77.824V256zM194.56 409.6v204.8c0 12.288 8.192 20.48 20.48 20.48s20.48-8.192 20.48-20.48V409.6c0-12.288-8.192-20.48-20.48-20.48s-20.48 8.192-20.48 20.48z" p-id="3203"></path></svg>`,
        content: {
            type: 'addSelection'
        },
    });
};